package com.ruoyi.training.dto;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.ruoyi.common.core.constant.UserConstants;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.system.api.domain.SysDept;
import com.ruoyi.training.domain.Projects;

import java.util.List;
import java.util.stream.Collectors;

public class ProjectTreeSelect {
    private static final long serialVersionUID = 1L;

    /** 节点ID */
    private String id;

    /** 节点名称 */
    private String label;

    /** 节点ID */
    private String text;

    /** 节点值 */
    private String value;

    /** 节点禁用 */
    private boolean disabled = false;

    /** 子节点 */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<ProjectTreeSelect> children;
    public ProjectTreeSelect()
    {

    }

    public ProjectTreeSelect(Projects projects)
    {
        this.id = projects.getProjectId();
        this.value = projects.getProjectId();
        this.text = projects.getProjectName();
        this.label = projects.getProjectName();
        this.children = projects.getChildren().stream().map(ProjectTreeSelect::new).collect(Collectors.toList());
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getId()
    {
        return id;
    }

    public void setId(String id)
    {
        this.id = id;
    }

    public String getLabel()
    {
        return label;
    }

    public void setLabel(String label)
    {
        this.label = label;
    }

    public boolean isDisabled()
    {
        return disabled;
    }

    public void setDisabled(boolean disabled)
    {
        this.disabled = disabled;
    }

    public List<ProjectTreeSelect> getChildren()
    {
        return children;
    }

    public void setChildren(List<ProjectTreeSelect> children)
    {
        this.children = children;
    }
}
